//获取国际语言标志
var type = getCookie("language");
var zj='';
var TDataSelectionCtrl_Name = '';
if (type == 'zh_CN') {
    zj = "转交";
} else if (type == 'en_US') {
    zj = "Transfer";
} else if (type == 'zh_TW') {
    zj = "轉交";
} else {
    zj = "转交";
}
function noneperson(fn){//无主办会签问题 解决 访问workfastadd接口 获取当前流程是否是无主办会签类型
    $.extend({
        getQueryString: function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
    });
    var opflag =  $.getQueryString("opflag") || 1;
    if(opflag == 0){
        var flowId = $.getQueryString("flowId");
        var flowStep = $.getQueryString("flowStep") || '';
        var prcsId = $.getQueryString("prcsId") || '';
        var runId = $.getQueryString("runId") || '';
        var tableName = $.getQueryString("tableName") || '';
        var tabId =  $.getQueryString("tabId") || '';
        // var href = url.split('opflag=')[0] + 'opflag=1' + url.split('opflag=')[1].substring(1);
        // window.location.href = href;
        $.ajax({
            url: '../../workflow/work/workfastAdd',//URL
            data: {
                flowId: flowId,
                runId: runId,
                prcsId: prcsId,
                flowStep: flowStep,
                tableName:tableName,
                tabId:tabId
            },
            type: 'get',
            datatype: 'json',
            success: function (json) {
                var data = json.object.flowRunPrcs;
                var url = location.href;
                if(data.opFlag == 1){

                    if(url.indexOf('workformh5') > -1){
                        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                            try{
                                window.webkit.messageHandlers.rightTitle.postMessage({'title':zj,'name':'321','function':'turn'});
                            }catch(err){
                                rightTitle(zj,'321','turn');
                            }
                        } else if (/(Android)/i.test(navigator.userAgent)) {
                            Android.rightTitle(zj,'321','turn');
                        }
                    }else{
                        $('#foot_rig').show();
                        $('#foot_rig1').hide();
                    }
                }else{
                    if(url.indexOf('workformh5') > -1){
                        $('.type_done').hide();
                        $('#lctbtn').show();
                        $('#opflagturn').show();
                        $('#formInfo').show();
                    }
                }
                $('body').show();
                if(fn != undefined){
                    fn();
                }
            }
        });


    }else{
        $('body').show();
        if(fn != undefined){
            fn();
        }
    }
}

function TDataSelectionCtrl(e){//处理了数据源控件 按钮点击功能
    TDataSelectionCtrl_Name = e.attr('name');
    var data_control = e.attr("DATA_CONTROL");
    var item_str = '';
    if(data_control){
        item_str = [];
        for(var i=0;i<data_control.split('`').length;i++){
            if(data_control.split('`')[i] != ''){
                item_str.push(workForm.correspondence.objectTD[data_control.split('`')[i]]);
            }
        }
        item_str = item_str.join(',');
    }
    var url = "/form/dataPicker?item_str="+item_str;
    // var URL = "dataSrc=" + dataSrc + "&dataField=" + dataField + "&dataFieldName=" + dataFieldName + "&item_str=" + item_str + "&type=" + type + "&objName=" + obj.name + "&dataQuery=" + dataQuery;
    //"item_str=DATA_114,DATA_115,DATA_146,DATA_291,DATA_273,DATA_287,DATA_143,DATA_293,DATA_297,DATA_298,DATA_294,DATA_299,DATA_295,DATA_304,&type=undefined&objName=DATA_300&dataQuery=1`1`0`0`0`0`0`0`0`0`0`0`0`"
    $.popWindow(url,'数据源选人控件','20','150','1200px','600px');
}
